MIN_2D_ARRAY block

Short summary

Name

MIN_2D_ARRAY_LINT, MIN_2D_ARRAY_ULINT, MIN_2D_ARRAY_LREAL

→POU type

→function

Category

IEC-block, NumericEnh, block with internal error diagnostic

Conform to →IEC-standard

(plus) not defined in IEC-standard

Graphical interface

, ,

Available since

  • version 1.45.0 (for Neuron Power Engineer) – initial variant

  • version 2.0.9 (for library Standard) – graphical interface with in-out variable

Functionality

The block returns the smallest of all values of an array with 2 dimensions entered at input A. Only the first M rows and N columns are considered. The array must contain at least M rows and N columns.

Inputs, return value

MIN_2D_ARRAY_LINT

Identifier

→Data type

Description

In-outs
(VAR_IN_OUT):

A

ARRAY [*,*] OF SINT, INT, DINT or LIN
(corresponds to →generic data type ANY_SIGNED)

variable-length array

Inputs:

M

UINT

number of rows to consider

N

UINT

number of columns to consider

Return value:

LINT

  • minimum value

  • 0 in case of an error or if M or N = 0

 

MIN_2D_ARRAY_ULINT

Identifier

→Data type

Description

In-outs
(VAR_IN_OUT):

A

ARRAY [*,*] OF USINT, UINT, UDINT or ULINT
(corresponds to →generic data type ANY_UNSIGNED)

variable-length array

Inputs:

M

UINT

number of rows to consider

N

UINT

number of columns to consider

Return value:

ULINT

  • minimum value

  • 0 in case of an error or if M or N = 0

 

MIN_2D_ARRAY_LREAL

Identifier

→Data type

Description

In-outs
(VAR_IN_OUT):

A

ARRAY [*,*] OF REAL, LREAL
(corresponds to →generic data type ANY_REAL)

variable-length array

Inputs:

M

UINT

number of rows to consider

N

UINT

number of columns to consider

Return value:

LREAL

  • minimum value

  • 0.0 in case of an error or if M or N = 0

Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

See:

Internal error diagnostic for block

The block checks whether the size of the array for A contains at least M rows and N columns. If this is not the case, the output ENO of the block is set to value FALSE (or an equivalent).

Example for usage within ST-editor

FUNCTION_BLOCK ExampleMin2DArray
    VAR
        inputArray : ARRAY [1..2, -1..1] OF LINT := [2( [1, 2, 3])];
        result1, result2 : LINT;
        enoCheck1, enoCheck2 : BOOL;
    END_VAR
    result1 := MIN_2D_ARRAY_LINT(A := inputArray, M := 2, N := 3, ENO => enoCheck1);
    // 'result1' evaluates to value '1'. 'enoCheck1' evaluates to 'TRUE'.
    
    // check the results
    ENO := AND(result1 = 1, enoCheck1);
    result2 := MIN_2D_ARRAY_LINT(A := inputArray, M := 3, N := 2, ENO => enoCheck2);
    // 'enoCheck2' evaluates to 'FALSE' because 'inputArray' has only 2 rows.
    // 'result2' evaluates to '0'.   
    // check the results     
    ENO := AND(ENO, result2 = 0, NOT(enoCheck2));
END_FUNCTION_BLOCK

When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.